<template>
    <div class="duihua">
        <!-- <div class="toubu">
            <div class="icon" @click="to">
                <img src="@/assets/images/fanhui.png" alt="">
            </div>
            <div class="al">
                <div class="xiaoji"><img src="@/assets/images/zn.png" alt=""></div>
                <div class="zi">AI小助理</div>
            </div>
        </div> -->

        <div class="kuang" ref="scrollDiv">

            <div class="left" :class="{ 'show': ani[0] }">
                <div class="tu">
                    <img src="@/assets/images/zn.png" alt="">
                </div>
                <div class="hua">
                    <div class="title">
                        嗯噢哇小助理
                    </div>
                    <div class="content">
                        <div class="jizai" style="color: rgba(0,0,0,0.9);">
                            根据实时天气预报，9月27号下午2点会有暴雨。12小时内降雨量将达50毫米以上，则判定为暴雨蓝色预警。请问是否要进行启动暴雨预案？
                        </div>
                    </div>
                </div>
            </div>
            <div class="right" :class="{ 'show': renHuiFuArr[0] }">
                <div class="hua">
                    <!-- 请推荐最佳预案 -->
                    {{renHuiFuArr[0]}}
                </div>
                <div class="tu">
                    <img src="@/assets/images/juese2.jpg" alt="">
                </div>
            </div>
            <div class="left" :class="{ 'show':renHuiFuShowArr[0]}">
                <div class="tu">
                    <img src="@/assets/images/zn.png" alt="">
                </div>
                <div class="hua">
                    <div class="title">
                        嗯噢哇小助理
                    </div>
                    <div class="content">
                        <div class="xwItem">
                            <img src="~@/assets/images/juse1/juse1-img17.png" alt="">
                        </div>
                    </div>
                </div>
            </div>
            <div class="right" :class="{ 'show': ani[1] }">
                <div class="hua">
                    <!-- 执行此方案 -->
                    {{renHuiFuArr[1]}}
                </div>
                <div class="tu">
                    <img src="@/assets/images/juese2.jpg" alt="">
                </div>
            </div>
            <div class="left"  :class="{ 'show':renHuiFuShowArr[1]}">
                <div class="tu">
                    <img src="@/assets/images/zn.png" alt="">
                </div>
                <div class="hua">
                    <div class="title">
                        嗯噢哇小助理
                    </div>
                    <div class="content">
                        <div class="xwItem">
                            <img src="~@/assets/images/juse1/juse1-img18.png" alt="">
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="shuru">
            <el-input v-model="input" placeholder="请输入你的需求"></el-input>
            <div class="tijiao" @click="sendtext">
                <img src="@/assets/images/fasong.png" alt="">
            </div>
        </div>


    </div>
</template>

<script>
export default {
    data() {
        return {
            input: '',
            faIndex: '1',
            ani: [true, false, false, false, false],
            timer: null,
            an:0,
            renArr:['请推荐最佳预案','执行此方案'],
            renHuiFuArr:[],
            renHuiFuShowArr:[],
        }
    },
    destroyed() {
        var that = this;
        that.timer = null
        clearInterval(that.timer)
    },
    mounted() {
        var that = this;
        this.input = this.renArr[0]
    },
    methods: {
        sendtext(){
            var that = this;
            if(that.an >  this.renArr.length){
                return
            }
            this.ani[this.an] = true
            this.renHuiFuArr[this.an] = this.renArr[this.an] 
            this.$forceUpdate()
            console.log(this.an, this.renHuiFuArr,'this.an')
            this.input = ''
           
            setTimeout(() => {
                that.renHuiFuShowArr[that.an] =  true
                that.$forceUpdate()
                that.handleScrollBottom()
                that.an++;
                that.input = that.renArr[this.an] 
            },1000);
            
            this.handleScrollBottom()
           
        
        },
        // 滚动到底部
        handleScrollBottom() {
            this.$nextTick(() => {
                let scrollElem = this.$refs.scrollDiv;
                scrollElem.scrollTo({ top: scrollElem.scrollHeight, behavior: 'smooth' });
            });
        },
        name() {

        },
        to() {
            this.$router.go(-1)
        },
        faClick(num) {
            this.faIndex = num

            this.$router.push({
                path: '/govIndexData2/juese2',
            })
            window.localStorage.setItem("status", "2");
            console.log(this.faIndex, 'this.faIndex');
        },
    },
}
</script>

<style lang="scss" scoped>
.duihua {
    padding: 24px;
    box-sizing: border-box;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: #FFFFFF;
    box-shadow: 0px 0px 16px 0px rgba(0, 0, 0, 0.1);
    border-radius: 12px;

    .toubu {
        box-sizing: border-box;
        padding: 0 18px;
        display: flex;
        align-items: center;
        height: 88px;
        background: #FFFFFF;
        border-radius: 12px;
        box-shadow: 0px 1px 4px 0px rgba(13, 46, 166, 0.02), 0px 2px 12px 0px rgba(13, 46, 166, 0.04), 0px 2px 6px 0px rgba(13, 46, 166, 0.02);
    }

    .al {
        margin-left: 15px;
        display: flex;
        align-items: center;
        font-size: 20px;
        font-weight: 500;
        color: rgba(0, 0, 0, 0.9);
    }

    .icon {
        cursor: pointer;
        width: 22px;
        height: 22px;
    }

    .xiaoji {
        width: 33px;
        height: 33px;
    }

    img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .shuru {
    cursor: pointer;
        display: flex;
        justify-content: space-between;
        align-items: center;
        height: 56px;
        background: #F5F7FB;
        box-shadow: 0px 1px 4px 0px rgba(13, 46, 166, 0.02), 0px 2px 12px 0px rgba(13, 46, 166, 0.04), 0px 2px 6px 0px rgba(13, 46, 166, 0.02);
        border-radius: 8px;
        box-sizing: border-box;
        padding: 0 16px 0 0;

        /deep/ {
            .el-input__inner {
                border: none !important;
                background: #F5F7FB;
            }
        }

        .el-input {
            width: 90%;
        }

        .tijiao {
            width: 19px;
            height: 20px;
        }


    }

    .kuang {
        height: calc(100% - 100px);
        // padding: 50px 0;
        overflow-y: auto;
        margin: 20px 0;
        // border: 1px solid red;
        &>div {
            transition: all 0.4s;
            opacity: 0;
            visibility: hidden;
            height: 0;
            overflow: hidden;

            &.show {
                visibility: visible;
                opacity: 1;
                height: auto;
            }
           
        }

        .tu {
            width: 48px;
            height: 46px;
            border-radius: 50%;
            overflow: hidden;
            margin: 0 12px;

            img {
                width: 100%;
                height: 100%;
                object-fit: cover;
            }
        }

        .right {
            display: flex;
            justify-content: end;
            align-items: center;

            .hua {
                display: inline-block;
                background: #2C68FF;
                box-shadow: 0px 2px 6px 2px rgba(44, 104, 255, 0.16);
                border-radius: 16px 0px 16px 16px;
                padding: 25px 32px;
                font-size: 16px;
                font-weight: 500;
                color: #FFFFFF;
            }

            margin-bottom: 45px;
        }

        .left {
            display: flex;
            margin-bottom: 45px;

            .tu {
                width: 48px;
                height: 48px;
                background: #A4BFF1;
                display: flex;
                align-items: center;
                justify-content: center;

                img {
                    width: 30px;
                    height: 30px;
                }

            }

            .hua {
                padding-top: 8px;

                .title {
                    font-size: 14px;
                    font-weight: 600;
                    color: rgba(0, 0, 0, 0.9);
                }

                .content {
                    width: 876px;
                    margin-top: 14px;
                    padding: 24px;

                    background: #F5F7FB;
                    box-shadow: 0px 1px 4px 0px rgba(13, 46, 166, 0.02), 0px 2px 12px 0px rgba(13, 46, 166, 0.04), 0px 2px 6px 0px rgba(13, 46, 166, 0.02);
                    border-radius: 12px;

                    .jizai {
                        font-size: 14px;
                        line-height: 20px;
                        color: rgba(0, 0, 0, 0.6);

                        div {
                            font-weight: 600;
                            color: rgba(0, 0, 0, 1);
                        }
                    }

                    .qingkuang {
                        // width: 876px;
                        background: #F5F7FB;
                        border-radius: 12px;
                        padding: 40px;
                        margin: 24px 0 30px;

                        .tou {
                            font-size: 14px;
                            font-weight: 400;
                            color: rgba(0, 0, 0, 0.6);
                        }


                        .wenzi {
                            margin-top: 10px;
                            font-size: 14px;
                            font-weight: 600;
                            color: rgba(0, 0, 0, 0.9);

                            div {
                                color: rgba(153, 153, 153, 0.5);
                                margin-bottom: 10px;

                                span {
                                    color: rgba(0, 0, 0, 1);


                                }
                            }
                        }

                        .ksh {
                            margin: 60px 0 40px;
                            display: flex;
                            justify-content: center;

                            img {
                                height: 242px;
                                width: 330px;
                                object-fit: cover;
                            }
                        }



                    }

                    .fangan {

                        .faT {
                            font-size: 16px;
                            font-weight: 500;
                            color: rgba(0, 0, 0, 0.9);
                        }

                        .fangan1 {
                            margin-top: 16px;

                            img {

                                background: linear-gradient(180deg, #FFA400 0%, #FF6B00 100%);
                                border-radius: 12px;
                                object-fit: cover;
                            }



                            .fa {
                                cursor: pointer;
                                height: 80px;
                                background: #F8F9FA;
                                border-radius: 8px;
                                border: 1px solid rgba(151, 151, 151, 0.07);
                                box-sizing: border-box;
                                padding: 15px 28px;
                                font-size: 14px;
                                font-weight: 500;
                                color: rgba(0, 0, 0, 0.9);

                                &:hover {
                                    background: rgba(44, 104, 255, 0.09);
                                    border: 1px solid #2C68FF;
                                }

                                .con {
                                    margin-top: 8px;
                                    font-size: 14px;
                                    font-weight: 500;
                                    color: #2C68FF;

                                }
                            }

                            .active {
                                background: rgba(44, 104, 255, 0.09);
                                border: 1px solid #2C68FF;
                            }



                        }
                    }
                }
            }
        }

    }




}
</style>